import { Input } from "antd"
import { FC } from "react"

import { SFormItem } from "@/components/common"
import { useLocale } from "@/locales"
import { onlyPasteSanitizeCharacter, sanitizeInput } from "@/utils/validate"

const IpAttributionInput: FC<any> = ({ isHideLabel = false, isValidate = false }) => {
	const { formatMessage } = useLocale()
	return (
		<SFormItem name="ipAttribution" label={isHideLabel ? "" : formatMessage({ id: "member.ip_attribution" })}>
			<Input
				allowClear
				placeholder={formatMessage({ id: "risk.please_enter_Ip_Address" })}
				onChange={e => isValidate && sanitizeInput(e)}
				onPaste={e => isValidate && onlyPasteSanitizeCharacter(e)}
			/>
		</SFormItem>
	)
}

export default IpAttributionInput
